#ifndef __PRINTHELPER_H__
#define __PRINTHELPER_H__

template <class T>
void printInt(const T &v)
{
    cout << static_cast<int>(v) << ',';
}

template <class PairType>
void printPair(const PairType &p)
{
    cout << p.first << ":" << p.second << '\t';
}

template <class T>
void printIntMatrix(const T &container, int colNumber = 8)
{
    printMatrix(begin(container), end(container), &printInt<decltype(*begin(container))>, colNumber);
}

template <class T, class Func>
void printMatrix(T begin, T end, Func printDelegate, int colNumber = 8)
{
    int leftColnum = colNumber;
    for (auto i = begin, e = end; i != e; i++)
    {
        printDelegate(*i);
        if (--leftColnum == 0)
        {
            leftColnum = colNumber;
            cout << endl;
        }
    }
    cout << endl;
}

#endif // __PRINTHELPER_H__